<style lang="sass" scoped>

</style>

<template>
  <div class="container hasNav">
    <van-nav-bar title="抢单须知" left-arrow left-text="返回" @click-left="$router.back()" fixed />

    <van-collapse v-model="activeName" accordion>
      <van-collapse-item v-for="(item,index) in list" :key="index" :title="item.question" :name="index">
        {{item.answer}}
      </van-collapse-item>
    </van-collapse>
  </div>
</template>

<script>
import { getPickbook } from '../../api/index';

export default {
  name: 'Help',
  data() {
    return {
      activeName: '0',
      list:[]
    };
  },
  async beforeMount(){
    await this.getData();
  },
  methods:{
    async getData(){
      try {
        const { errorcode, errormsg, list } = await getPickbook();

        if(errorcode == 0){
          if(list.length !== 0){
            this.list = list;
          }
        }else{
          this.$toast(errormsg)
        }
      } catch (error) {
        console.log(error);
      }
    }
  }
};
</script>